namespace pos.entity
{
using System;
using System.Data;
using System.Configuration;
using System.Text;
using System.Data.OleDb;
using System.Collections;
using System.Windows.Forms;
using NHibernate;
using NHibernate.Criterion;
/// <summary>
/// t_salereport 的摘要说明
/// </summary>
public class t_salereport:IEntityUtil
{
	//   列名称哈希表 
	private static Hashtable m_colLabels;    	 
	public static Hashtable colLabels//
	{
		get{return m_colLabels;}
	}
	//表字段名称哈希表
	private static ArrayList m_colNames;     
	public static ArrayList  colNames　
	{
		get{return m_colNames;}
	}
	private Salereport __salereport;
	public long seqID  
	{
		get{return __salereport.seqID;}
		set{ __salereport.seqID=value;}
	}
	public long commoditySeqID  
	{
		get{return __salereport.commoditySeqID;}
		set{ __salereport.commoditySeqID=value;}
	}
	public String commodityID  
	{
		get{return __salereport.commodityID;}
		set{ __salereport.commodityID=value;}
	}
	public String commodityName  
	{
		get{return __salereport.commodityName;}
		set{ __salereport.commodityName=value;}
	}
	public double saleMoney  
	{
		get{return __salereport.saleMoney;}
		set{ __salereport.saleMoney=value;}
	}
	public double profitMoney  
	{
		get{return __salereport.profitMoney;}
		set{ __salereport.profitMoney=value;}
	}
	public double unsettleAmount  
	{
		get{return __salereport.unsettleAmount;}
		set{ __salereport.unsettleAmount=value;}
	}
	public double unsettleMoney  
	{
		get{return __salereport.unsettleMoney;}
		set{ __salereport.unsettleMoney=value;}
	}
	public double saleAmount  
	{
		get{return __salereport.saleAmount;}
		set{ __salereport.saleAmount=value;}
	}
	public double returnedAmount  
	{
		get{return __salereport.returnedAmount;}
		set{ __salereport.returnedAmount=value;}
	}
	public double stockAmount  
	{
		get{return __salereport.stockAmount;}
		set{ __salereport.stockAmount=value;}
	}
	public double unsettleAllAmount  
	{
		get{return __salereport.unsettleAllAmount;}
		set{ __salereport.unsettleAllAmount=value;}
	}
	public double unsettleAllMoney  
	{
		get{return __salereport.unsettleAllMoney;}
		set{ __salereport.unsettleAllMoney=value;}
	}
	public double storageAmount  
	{
		get{return __salereport.storageAmount;}
		set{ __salereport.storageAmount=value;}
	}
	public double saleAllAmount  
	{
		get{return __salereport.saleAllAmount;}
		set{ __salereport.saleAllAmount=value;}
	}
	public double returnedAllAmount  
	{
		get{return __salereport.returnedAllAmount;}
		set{ __salereport.returnedAllAmount=value;}
	}
	public double stockAllAmount  
	{
		get{return __salereport.stockAllAmount;}
		set{ __salereport.stockAllAmount=value;}
	}
	public double profitAllMoney  
	{
		get{return __salereport.profitAllMoney;}
		set{ __salereport.profitAllMoney=value;}
	}
	public double lossAllMoney  
	{
		get{return __salereport.lossAllMoney;}
		set{ __salereport.lossAllMoney=value;}
	}
	public double stockAllMoney  
	{
		get{return __salereport.stockAllMoney;}
		set{ __salereport.stockAllMoney=value;}
	}
	public double saleAllMoney  
	{
		get{return __salereport.saleAllMoney;}
		set{ __salereport.saleAllMoney=value;}
	}
	public double storageMoney  
	{
		get{return __salereport.storageMoney;}
		set{ __salereport.storageMoney=value;}
	}
	public double costAllMoney  
	{
		get{return __salereport.costAllMoney;}
		set{ __salereport.costAllMoney=value;}
	}
	public double returnedMoney  
	{
		get{return __salereport.returnedMoney;}
		set{ __salereport.returnedMoney=value;}
	}
	public double lossMoney  
	{
		get{return __salereport.lossMoney;}
		set{ __salereport.lossMoney=value;}
	}
	public double stockMoney  
	{
		get{return __salereport.stockMoney;}
		set{ __salereport.stockMoney=value;}
	}
	public double costMoney  
	{
		get{return __salereport.costMoney;}
		set{ __salereport.costMoney=value;}
	}
	public double returnedAllMoney  
	{
		get{return __salereport.returnedAllMoney;}
		set{ __salereport.returnedAllMoney=value;}
	}
	public double returnedCostAllMoney  
	{
		get{return __salereport.returnedCostAllMoney;}
		set{ __salereport.returnedCostAllMoney=value;}
	}
	public DateTime saleDate  
	{
		get{return __salereport.saleDate;}
		set{ __salereport.saleDate=value;}
	}
	private static  SalereportDao dao=(SalereportDao)SpringContext.Context.GetObject("SalereportDao");
	public static SalereportDao DAO
	{
		get{return dao;}
		
	}
	
	public t_salereport()
	{
		__salereport=new Salereport();
	  	seqID=consts.long_min;
	  	commoditySeqID=consts.long_min;
	  	commodityID="";
	  	commodityName="";
	  	saleMoney=0;
	  	profitMoney=0;
	  	unsettleAmount=0;
	  	unsettleMoney=0;
	  	saleAmount=0;
	  	returnedAmount=0;
	  	stockAmount=0;
	  	unsettleAllAmount=0;
	  	unsettleAllMoney=0;
	  	storageAmount=0;
	  	saleAllAmount=0;
	  	returnedAllAmount=0;
	  	stockAllAmount=0;
	  	profitAllMoney=0;
	  	lossAllMoney=0;
	  	stockAllMoney=0;
	  	saleAllMoney=0;
	  	storageMoney=0;
	  	costAllMoney=0;
	  	returnedMoney=0;
	  	lossMoney=0;
	  	stockMoney=0;
	  	costMoney=0;
	  	returnedAllMoney=0;
	  	returnedCostAllMoney=0;
	  	saleDate=DateTime.Now;
	  // dao=(SalereportDao)SpringContext.Context.GetObject("SalereportDao");
	   if(m_colLabels==null)
	   {
		m_colLabels = new Hashtable();
        m_colNames= new ArrayList();
		m_colLabels.Add("seqID", @"编号");
		colNames.Add("seqID");
		m_colLabels.Add("commoditySeqID", @"商品序号");
		colNames.Add("commoditySeqID");
		m_colLabels.Add("commodityID", @"商品条形码");
		colNames.Add("commodityID");
		m_colLabels.Add("commodityName", @"商品名称");
		colNames.Add("commodityName");
		m_colLabels.Add("saleMoney", @"销售额");
		colNames.Add("saleMoney");
		m_colLabels.Add("profitMoney", @"利润");
		colNames.Add("profitMoney");
		m_colLabels.Add("unsettleAmount", @"未结数");
		colNames.Add("unsettleAmount");
		m_colLabels.Add("unsettleMoney", @"未结额");
		colNames.Add("unsettleMoney");
		m_colLabels.Add("saleAmount", @"销售数");
		colNames.Add("saleAmount");
		m_colLabels.Add("returnedAmount", @"出库数");
		colNames.Add("returnedAmount");
		m_colLabels.Add("stockAmount", @"入库数");
		colNames.Add("stockAmount");
		m_colLabels.Add("unsettleAllAmount", @"合计未结数");
		colNames.Add("unsettleAllAmount");
		m_colLabels.Add("unsettleAllMoney", @"合计未结额");
		colNames.Add("unsettleAllMoney");
		m_colLabels.Add("storageAmount", @"库存数");
		colNames.Add("storageAmount");
		m_colLabels.Add("saleAllAmount", @"合计销售数");
		colNames.Add("saleAllAmount");
		m_colLabels.Add("returnedAllAmount", @"合计出库数");
		colNames.Add("returnedAllAmount");
		m_colLabels.Add("stockAllAmount", @"合计入库数");
		colNames.Add("stockAllAmount");
		m_colLabels.Add("profitAllMoney", @"合计销售利润");
		colNames.Add("profitAllMoney");
		m_colLabels.Add("lossAllMoney", @"合计 出库亏损");
		colNames.Add("lossAllMoney");
		m_colLabels.Add("stockAllMoney", @"合计入库额");
		colNames.Add("stockAllMoney");
		m_colLabels.Add("saleAllMoney", @"合计销售额");
		colNames.Add("saleAllMoney");
		m_colLabels.Add("storageMoney", @"当前库存额");
		colNames.Add("storageMoney");
		m_colLabels.Add("costAllMoney", @"合计成本");
		colNames.Add("costAllMoney");
		m_colLabels.Add("returnedMoney", @"当日出库额");
		colNames.Add("returnedMoney");
		m_colLabels.Add("lossMoney", @"当日损耗额");
		colNames.Add("lossMoney");
		m_colLabels.Add("stockMoney", @"当日入库额");
		colNames.Add("stockMoney");
		m_colLabels.Add("costMoney", @"当日销售成本");
		colNames.Add("costMoney");
		m_colLabels.Add("returnedAllMoney", @"合计出库额");
		colNames.Add("returnedAllMoney");
		m_colLabels.Add("returnedCostAllMoney", @"合计出库成本");
		colNames.Add("returnedCostAllMoney");
		m_colLabels.Add("saleDate", @"销售日期");
		colNames.Add("saleDate");
	  }
	
	}
	public t_salereport(Salereport entity )
	{
		__salereport=entity;
		
	  // dao=(SalereportDao)SpringContext.Context.GetObject("SalereportDao");
	   if(m_colLabels==null)
	   {
		m_colLabels = new Hashtable();
        m_colNames= new ArrayList();
		m_colLabels.Add("seqID", @"编号");
		colNames.Add("seqID");
		m_colLabels.Add("commoditySeqID", @"商品序号");
		colNames.Add("commoditySeqID");
		m_colLabels.Add("commodityID", @"商品条形码");
		colNames.Add("commodityID");
		m_colLabels.Add("commodityName", @"商品名称");
		colNames.Add("commodityName");
		m_colLabels.Add("saleMoney", @"销售额");
		colNames.Add("saleMoney");
		m_colLabels.Add("profitMoney", @"利润");
		colNames.Add("profitMoney");
		m_colLabels.Add("unsettleAmount", @"未结数");
		colNames.Add("unsettleAmount");
		m_colLabels.Add("unsettleMoney", @"未结额");
		colNames.Add("unsettleMoney");
		m_colLabels.Add("saleAmount", @"销售数");
		colNames.Add("saleAmount");
		m_colLabels.Add("returnedAmount", @"出库数");
		colNames.Add("returnedAmount");
		m_colLabels.Add("stockAmount", @"入库数");
		colNames.Add("stockAmount");
		m_colLabels.Add("unsettleAllAmount", @"合计未结数");
		colNames.Add("unsettleAllAmount");
		m_colLabels.Add("unsettleAllMoney", @"合计未结额");
		colNames.Add("unsettleAllMoney");
		m_colLabels.Add("storageAmount", @"库存数");
		colNames.Add("storageAmount");
		m_colLabels.Add("saleAllAmount", @"合计销售数");
		colNames.Add("saleAllAmount");
		m_colLabels.Add("returnedAllAmount", @"合计出库数");
		colNames.Add("returnedAllAmount");
		m_colLabels.Add("stockAllAmount", @"合计入库数");
		colNames.Add("stockAllAmount");
		m_colLabels.Add("profitAllMoney", @"合计销售利润");
		colNames.Add("profitAllMoney");
		m_colLabels.Add("lossAllMoney", @"合计 出库亏损");
		colNames.Add("lossAllMoney");
		m_colLabels.Add("stockAllMoney", @"合计入库额");
		colNames.Add("stockAllMoney");
		m_colLabels.Add("saleAllMoney", @"合计销售额");
		colNames.Add("saleAllMoney");
		m_colLabels.Add("storageMoney", @"当前库存额");
		colNames.Add("storageMoney");
		m_colLabels.Add("costAllMoney", @"合计成本");
		colNames.Add("costAllMoney");
		m_colLabels.Add("returnedMoney", @"当日出库额");
		colNames.Add("returnedMoney");
		m_colLabels.Add("lossMoney", @"当日损耗额");
		colNames.Add("lossMoney");
		m_colLabels.Add("stockMoney", @"当日入库额");
		colNames.Add("stockMoney");
		m_colLabels.Add("costMoney", @"当日销售成本");
		colNames.Add("costMoney");
		m_colLabels.Add("returnedAllMoney", @"合计出库额");
		colNames.Add("returnedAllMoney");
		m_colLabels.Add("returnedCostAllMoney", @"合计出库成本");
		colNames.Add("returnedCostAllMoney");
		m_colLabels.Add("saleDate", @"销售日期");
		colNames.Add("saleDate");
	  }
	
	}
	public Object uniqueResult(DetachedCriteria dc)
    {
        return dao.uniqueResult(dc);
    }
	 public DetachedCriteria DC 
     {
        	get{return DetachedCriteria.For(typeof(Salereport));}
     }
	public const string ENTITYNAME="t_salereport";
	public const int SEQN0=165;
	
    public void checkAdd()
    {
		int len;
	//try{Convert.ToInt64(seqID);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	seqID<consts.long_min+1)
			throw (new Exception("请输入编号"));
 if(				(				  string.Format("{0}",seqID)				  )=="0")
	 throw (new Exception("编号是主健，框架要求值不能为0"));				

	//try{Convert.ToInt64(commoditySeqID);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	commoditySeqID<consts.long_min+1)
			throw (new Exception("请输入商品序号"));

	
	len=commodityID.Trim().Length;
	if(len>60)
		 throw (new Exception("商品条形码字符长度最长不能超过60,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("商品条形码不能为空!"));	
	

	
	len=commodityName.Trim().Length;
	if(len>50)
		 throw (new Exception("商品名称字符长度最长不能超过50,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("商品名称不能为空!"));	
	

	//try{Convert.ToDouble(saleMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	saleMoney<consts.double_min+1)
			throw (new Exception("请输入销售额"));
		if(saleMoney>0)
			saleMoney+=0.000001;
		if(saleMoney<0)
			saleMoney-=0.000001;
		
			if(((long)((saleMoney)*100 ))*10!=(long)((saleMoney)*1000) )
				throw (new Exception("销售额小数精度不能大于2位saleMoney="+saleMoney.ToString()));
		if(saleMoney>0)
			saleMoney-=0.000001;
		if(saleMoney<0)
			saleMoney+=0.000001;
	

//do not check profitMoney 

	//try{Convert.ToDouble(unsettleAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	unsettleAmount<consts.double_min+1)
			throw (new Exception("请输入未结数"));
		if(unsettleAmount>0)
			unsettleAmount+=0.000001;
		if(unsettleAmount<0)
			unsettleAmount-=0.000001;
		
			if(((long)((unsettleAmount)*100 ))*10!=(long)((unsettleAmount)*1000) )
				throw (new Exception("未结数小数精度不能大于2位unsettleAmount="+unsettleAmount.ToString()));
		if(unsettleAmount>0)
			unsettleAmount-=0.000001;
		if(unsettleAmount<0)
			unsettleAmount+=0.000001;
	

//do not check unsettleMoney 

	//try{Convert.ToDouble(saleAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	saleAmount<consts.double_min+1)
			throw (new Exception("请输入销售数"));
		if(saleAmount>0)
			saleAmount+=0.000001;
		if(saleAmount<0)
			saleAmount-=0.000001;
		
			if(((long)((saleAmount)*100 ))*10!=(long)((saleAmount)*1000) )
				throw (new Exception("销售数小数精度不能大于2位saleAmount="+saleAmount.ToString()));
		if(saleAmount>0)
			saleAmount-=0.000001;
		if(saleAmount<0)
			saleAmount+=0.000001;
	

	//try{Convert.ToDouble(returnedAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	returnedAmount<consts.double_min+1)
			throw (new Exception("请输入出库数"));
		if(returnedAmount>0)
			returnedAmount+=0.000001;
		if(returnedAmount<0)
			returnedAmount-=0.000001;
		
			if(((long)((returnedAmount)*100 ))*10!=(long)((returnedAmount)*1000) )
				throw (new Exception("出库数小数精度不能大于2位returnedAmount="+returnedAmount.ToString()));
		if(returnedAmount>0)
			returnedAmount-=0.000001;
		if(returnedAmount<0)
			returnedAmount+=0.000001;
	

	//try{Convert.ToDouble(stockAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	stockAmount<consts.double_min+1)
			throw (new Exception("请输入入库数"));
		if(stockAmount>0)
			stockAmount+=0.000001;
		if(stockAmount<0)
			stockAmount-=0.000001;
		
			if(((long)((stockAmount)*100 ))*10!=(long)((stockAmount)*1000) )
				throw (new Exception("入库数小数精度不能大于2位stockAmount="+stockAmount.ToString()));
		if(stockAmount>0)
			stockAmount-=0.000001;
		if(stockAmount<0)
			stockAmount+=0.000001;
	

	//try{Convert.ToDouble(unsettleAllAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	unsettleAllAmount<consts.double_min+1)
			throw (new Exception("请输入合计未结数"));
		if(unsettleAllAmount>0)
			unsettleAllAmount+=0.000001;
		if(unsettleAllAmount<0)
			unsettleAllAmount-=0.000001;
		
			if(((long)((unsettleAllAmount)*100 ))*10!=(long)((unsettleAllAmount)*1000) )
				throw (new Exception("合计未结数小数精度不能大于2位unsettleAllAmount="+unsettleAllAmount.ToString()));
		if(unsettleAllAmount>0)
			unsettleAllAmount-=0.000001;
		if(unsettleAllAmount<0)
			unsettleAllAmount+=0.000001;
	

	//try{Convert.ToDouble(unsettleAllMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	unsettleAllMoney<consts.double_min+1)
			throw (new Exception("请输入合计未结额"));
		if(unsettleAllMoney>0)
			unsettleAllMoney+=0.000001;
		if(unsettleAllMoney<0)
			unsettleAllMoney-=0.000001;
		
			if(((long)((unsettleAllMoney)*100 ))*10!=(long)((unsettleAllMoney)*1000) )
				throw (new Exception("合计未结额小数精度不能大于2位unsettleAllMoney="+unsettleAllMoney.ToString()));
		if(unsettleAllMoney>0)
			unsettleAllMoney-=0.000001;
		if(unsettleAllMoney<0)
			unsettleAllMoney+=0.000001;
	

	//try{Convert.ToDouble(storageAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	storageAmount<consts.double_min+1)
			throw (new Exception("请输入库存数"));
		if(storageAmount>0)
			storageAmount+=0.000001;
		if(storageAmount<0)
			storageAmount-=0.000001;
		
			if(((long)((storageAmount)*100 ))*10!=(long)((storageAmount)*1000) )
				throw (new Exception("库存数小数精度不能大于2位storageAmount="+storageAmount.ToString()));
		if(storageAmount>0)
			storageAmount-=0.000001;
		if(storageAmount<0)
			storageAmount+=0.000001;
	

	//try{Convert.ToDouble(saleAllAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	saleAllAmount<consts.double_min+1)
			throw (new Exception("请输入合计销售数"));
		if(saleAllAmount>0)
			saleAllAmount+=0.000001;
		if(saleAllAmount<0)
			saleAllAmount-=0.000001;
		
			if(((long)((saleAllAmount)*100 ))*10!=(long)((saleAllAmount)*1000) )
				throw (new Exception("合计销售数小数精度不能大于2位saleAllAmount="+saleAllAmount.ToString()));
		if(saleAllAmount>0)
			saleAllAmount-=0.000001;
		if(saleAllAmount<0)
			saleAllAmount+=0.000001;
	

	//try{Convert.ToDouble(returnedAllAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	returnedAllAmount<consts.double_min+1)
			throw (new Exception("请输入合计出库数"));
		if(returnedAllAmount>0)
			returnedAllAmount+=0.000001;
		if(returnedAllAmount<0)
			returnedAllAmount-=0.000001;
		
			if(((long)((returnedAllAmount)*100 ))*10!=(long)((returnedAllAmount)*1000) )
				throw (new Exception("合计出库数小数精度不能大于2位returnedAllAmount="+returnedAllAmount.ToString()));
		if(returnedAllAmount>0)
			returnedAllAmount-=0.000001;
		if(returnedAllAmount<0)
			returnedAllAmount+=0.000001;
	

	//try{Convert.ToDouble(stockAllAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	stockAllAmount<consts.double_min+1)
			throw (new Exception("请输入合计入库数"));
		if(stockAllAmount>0)
			stockAllAmount+=0.000001;
		if(stockAllAmount<0)
			stockAllAmount-=0.000001;
		
			if(((long)((stockAllAmount)*100 ))*10!=(long)((stockAllAmount)*1000) )
				throw (new Exception("合计入库数小数精度不能大于2位stockAllAmount="+stockAllAmount.ToString()));
		if(stockAllAmount>0)
			stockAllAmount-=0.000001;
		if(stockAllAmount<0)
			stockAllAmount+=0.000001;
	

//do not check profitAllMoney 

//do not check lossAllMoney 

//do not check stockAllMoney 

//do not check saleAllMoney 

//do not check storageMoney 

//do not check costAllMoney 

//do not check returnedMoney 

//do not check lossMoney 

//do not check stockMoney 

//do not check costMoney 

	//try{Convert.ToDouble(returnedAllMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	returnedAllMoney<consts.double_min+1)
			throw (new Exception("请输入合计出库额"));
		if(returnedAllMoney>0)
			returnedAllMoney+=0.000001;
		if(returnedAllMoney<0)
			returnedAllMoney-=0.000001;
		
			if(((long)((returnedAllMoney)*100 ))*10!=(long)((returnedAllMoney)*1000) )
				throw (new Exception("合计出库额小数精度不能大于2位returnedAllMoney="+returnedAllMoney.ToString()));
		if(returnedAllMoney>0)
			returnedAllMoney-=0.000001;
		if(returnedAllMoney<0)
			returnedAllMoney+=0.000001;
	

	//try{Convert.ToDouble(returnedCostAllMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	returnedCostAllMoney<consts.double_min+1)
			throw (new Exception("请输入合计出库成本"));
		if(returnedCostAllMoney>0)
			returnedCostAllMoney+=0.000001;
		if(returnedCostAllMoney<0)
			returnedCostAllMoney-=0.000001;
		
			if(((long)((returnedCostAllMoney)*100 ))*10!=(long)((returnedCostAllMoney)*1000) )
				throw (new Exception("合计出库成本小数精度不能大于2位returnedCostAllMoney="+returnedCostAllMoney.ToString()));
		if(returnedCostAllMoney>0)
			returnedCostAllMoney-=0.000001;
		if(returnedCostAllMoney<0)
			returnedCostAllMoney+=0.000001;
	

	//try{Convert.ToDateTime(saleDate);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	saleDate.ToString().CompareTo(consts.datetime_min) <= 0 )
			throw (new Exception("请输入销售日期"));

//unique="yes" 唯一性验证
    }
    public void checkUpdate()
    {
		int len;
	//try{Convert.ToInt64(seqID);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	seqID<consts.long_min+1)
			throw (new Exception("请输入编号"));
 if(				(				  string.Format("{0}",seqID)				  )=="0")
	 throw (new Exception("编号是主健，框架要求值不能为0"));				

	//try{Convert.ToInt64(commoditySeqID);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	commoditySeqID<consts.long_min+1)
			throw (new Exception("请输入商品序号"));

	
	len=commodityID.Trim().Length;
	if(len>60)
		 throw (new Exception("商品条形码字符长度最长不能超过60,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("商品条形码不能为空!"));	
	

	
	len=commodityName.Trim().Length;
	if(len>50)
		 throw (new Exception("商品名称字符长度最长不能超过50,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("商品名称不能为空!"));	
	

	//try{Convert.ToDouble(saleMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	saleMoney<consts.double_min+1)
			throw (new Exception("请输入销售额"));
		if(saleMoney>0)
			saleMoney+=0.000001;
		if(saleMoney<0)
			saleMoney-=0.000001;
		
			if(((long)((saleMoney)*100 ))*10!=(long)((saleMoney)*1000) )
				throw (new Exception("销售额小数精度不能大于2位saleMoney="+saleMoney.ToString()));
		if(saleMoney>0)
			saleMoney-=0.000001;
		if(saleMoney<0)
			saleMoney+=0.000001;
	

//do not check profitMoney 

	//try{Convert.ToDouble(unsettleAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	unsettleAmount<consts.double_min+1)
			throw (new Exception("请输入未结数"));
		if(unsettleAmount>0)
			unsettleAmount+=0.000001;
		if(unsettleAmount<0)
			unsettleAmount-=0.000001;
		
			if(((long)((unsettleAmount)*100 ))*10!=(long)((unsettleAmount)*1000) )
				throw (new Exception("未结数小数精度不能大于2位unsettleAmount="+unsettleAmount.ToString()));
		if(unsettleAmount>0)
			unsettleAmount-=0.000001;
		if(unsettleAmount<0)
			unsettleAmount+=0.000001;
	

//do not check unsettleMoney 

	//try{Convert.ToDouble(saleAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	saleAmount<consts.double_min+1)
			throw (new Exception("请输入销售数"));
		if(saleAmount>0)
			saleAmount+=0.000001;
		if(saleAmount<0)
			saleAmount-=0.000001;
		
			if(((long)((saleAmount)*100 ))*10!=(long)((saleAmount)*1000) )
				throw (new Exception("销售数小数精度不能大于2位saleAmount="+saleAmount.ToString()));
		if(saleAmount>0)
			saleAmount-=0.000001;
		if(saleAmount<0)
			saleAmount+=0.000001;
	

	//try{Convert.ToDouble(returnedAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	returnedAmount<consts.double_min+1)
			throw (new Exception("请输入出库数"));
		if(returnedAmount>0)
			returnedAmount+=0.000001;
		if(returnedAmount<0)
			returnedAmount-=0.000001;
		
			if(((long)((returnedAmount)*100 ))*10!=(long)((returnedAmount)*1000) )
				throw (new Exception("出库数小数精度不能大于2位returnedAmount="+returnedAmount.ToString()));
		if(returnedAmount>0)
			returnedAmount-=0.000001;
		if(returnedAmount<0)
			returnedAmount+=0.000001;
	

	//try{Convert.ToDouble(stockAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	stockAmount<consts.double_min+1)
			throw (new Exception("请输入入库数"));
		if(stockAmount>0)
			stockAmount+=0.000001;
		if(stockAmount<0)
			stockAmount-=0.000001;
		
			if(((long)((stockAmount)*100 ))*10!=(long)((stockAmount)*1000) )
				throw (new Exception("入库数小数精度不能大于2位stockAmount="+stockAmount.ToString()));
		if(stockAmount>0)
			stockAmount-=0.000001;
		if(stockAmount<0)
			stockAmount+=0.000001;
	

	//try{Convert.ToDouble(unsettleAllAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	unsettleAllAmount<consts.double_min+1)
			throw (new Exception("请输入合计未结数"));
		if(unsettleAllAmount>0)
			unsettleAllAmount+=0.000001;
		if(unsettleAllAmount<0)
			unsettleAllAmount-=0.000001;
		
			if(((long)((unsettleAllAmount)*100 ))*10!=(long)((unsettleAllAmount)*1000) )
				throw (new Exception("合计未结数小数精度不能大于2位unsettleAllAmount="+unsettleAllAmount.ToString()));
		if(unsettleAllAmount>0)
			unsettleAllAmount-=0.000001;
		if(unsettleAllAmount<0)
			unsettleAllAmount+=0.000001;
	

	//try{Convert.ToDouble(unsettleAllMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	unsettleAllMoney<consts.double_min+1)
			throw (new Exception("请输入合计未结额"));
		if(unsettleAllMoney>0)
			unsettleAllMoney+=0.000001;
		if(unsettleAllMoney<0)
			unsettleAllMoney-=0.000001;
		
			if(((long)((unsettleAllMoney)*100 ))*10!=(long)((unsettleAllMoney)*1000) )
				throw (new Exception("合计未结额小数精度不能大于2位unsettleAllMoney="+unsettleAllMoney.ToString()));
		if(unsettleAllMoney>0)
			unsettleAllMoney-=0.000001;
		if(unsettleAllMoney<0)
			unsettleAllMoney+=0.000001;
	

	//try{Convert.ToDouble(storageAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	storageAmount<consts.double_min+1)
			throw (new Exception("请输入库存数"));
		if(storageAmount>0)
			storageAmount+=0.000001;
		if(storageAmount<0)
			storageAmount-=0.000001;
		
			if(((long)((storageAmount)*100 ))*10!=(long)((storageAmount)*1000) )
				throw (new Exception("库存数小数精度不能大于2位storageAmount="+storageAmount.ToString()));
		if(storageAmount>0)
			storageAmount-=0.000001;
		if(storageAmount<0)
			storageAmount+=0.000001;
	

	//try{Convert.ToDouble(saleAllAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	saleAllAmount<consts.double_min+1)
			throw (new Exception("请输入合计销售数"));
		if(saleAllAmount>0)
			saleAllAmount+=0.000001;
		if(saleAllAmount<0)
			saleAllAmount-=0.000001;
		
			if(((long)((saleAllAmount)*100 ))*10!=(long)((saleAllAmount)*1000) )
				throw (new Exception("合计销售数小数精度不能大于2位saleAllAmount="+saleAllAmount.ToString()));
		if(saleAllAmount>0)
			saleAllAmount-=0.000001;
		if(saleAllAmount<0)
			saleAllAmount+=0.000001;
	

	//try{Convert.ToDouble(returnedAllAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	returnedAllAmount<consts.double_min+1)
			throw (new Exception("请输入合计出库数"));
		if(returnedAllAmount>0)
			returnedAllAmount+=0.000001;
		if(returnedAllAmount<0)
			returnedAllAmount-=0.000001;
		
			if(((long)((returnedAllAmount)*100 ))*10!=(long)((returnedAllAmount)*1000) )
				throw (new Exception("合计出库数小数精度不能大于2位returnedAllAmount="+returnedAllAmount.ToString()));
		if(returnedAllAmount>0)
			returnedAllAmount-=0.000001;
		if(returnedAllAmount<0)
			returnedAllAmount+=0.000001;
	

	//try{Convert.ToDouble(stockAllAmount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	stockAllAmount<consts.double_min+1)
			throw (new Exception("请输入合计入库数"));
		if(stockAllAmount>0)
			stockAllAmount+=0.000001;
		if(stockAllAmount<0)
			stockAllAmount-=0.000001;
		
			if(((long)((stockAllAmount)*100 ))*10!=(long)((stockAllAmount)*1000) )
				throw (new Exception("合计入库数小数精度不能大于2位stockAllAmount="+stockAllAmount.ToString()));
		if(stockAllAmount>0)
			stockAllAmount-=0.000001;
		if(stockAllAmount<0)
			stockAllAmount+=0.000001;
	

//do not check profitAllMoney 

//do not check lossAllMoney 

//do not check stockAllMoney 

//do not check saleAllMoney 

//do not check storageMoney 

//do not check costAllMoney 

//do not check returnedMoney 

//do not check lossMoney 

//do not check stockMoney 

//do not check costMoney 

	//try{Convert.ToDouble(returnedAllMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	returnedAllMoney<consts.double_min+1)
			throw (new Exception("请输入合计出库额"));
		if(returnedAllMoney>0)
			returnedAllMoney+=0.000001;
		if(returnedAllMoney<0)
			returnedAllMoney-=0.000001;
		
			if(((long)((returnedAllMoney)*100 ))*10!=(long)((returnedAllMoney)*1000) )
				throw (new Exception("合计出库额小数精度不能大于2位returnedAllMoney="+returnedAllMoney.ToString()));
		if(returnedAllMoney>0)
			returnedAllMoney-=0.000001;
		if(returnedAllMoney<0)
			returnedAllMoney+=0.000001;
	

	//try{Convert.ToDouble(returnedCostAllMoney);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	returnedCostAllMoney<consts.double_min+1)
			throw (new Exception("请输入合计出库成本"));
		if(returnedCostAllMoney>0)
			returnedCostAllMoney+=0.000001;
		if(returnedCostAllMoney<0)
			returnedCostAllMoney-=0.000001;
		
			if(((long)((returnedCostAllMoney)*100 ))*10!=(long)((returnedCostAllMoney)*1000) )
				throw (new Exception("合计出库成本小数精度不能大于2位returnedCostAllMoney="+returnedCostAllMoney.ToString()));
		if(returnedCostAllMoney>0)
			returnedCostAllMoney-=0.000001;
		if(returnedCostAllMoney<0)
			returnedCostAllMoney+=0.000001;
	

	//try{Convert.ToDateTime(saleDate);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	saleDate.ToString().CompareTo(consts.datetime_min) <= 0 )
			throw (new Exception("请输入销售日期"));

//unique="yes" 唯一性验证
		ICriterion crit=Restrictions.Eq("seqID", seqID);
  		IList list=dao.List(dao.DC.Add(crit));
		if(list.Count==1)
			return;
		if(list.Count==0)
			throw (new Exception("该记录已经被删除"));	
		else
			throw (new Exception("改纪录出现重名!"));
    }
    public void add()
    {
        try
        {
            checkAdd();
         	dao.Add(__salereport);
        }
        catch(Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }
   
    public void delByseqID()
    {
    
        try
        {
          dao.Delete(__salereport);
        }
        catch(Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }

    public  void update()
    {
        try
        {
            checkUpdate();
            dao.Update(__salereport);
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }
   
    public void ExecDataUpdate(int rowNo)
    {
		if(m_updateRow==null)
			return;
		int ii=0;
m_updateRow(rowNo,ii++,commodityID);	
m_updateRow(rowNo,ii++,commodityName);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",saleMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",profitMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",unsettleAmount)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",unsettleMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",saleAmount)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",returnedAmount)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",stockAmount)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",unsettleAllAmount)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",unsettleAllMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",storageAmount)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",saleAllAmount)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",returnedAllAmount)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",stockAllAmount)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",profitAllMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",lossAllMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",stockAllMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",saleAllMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F4}",storageMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",costAllMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",returnedMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",lossMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",stockMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",costMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",returnedAllMoney)/***/)
);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",returnedCostAllMoney)/***/)
);	
m_updateRow(rowNo,ii++,			saleDate.ToString().CompareTo("1001-1-1")<0?"":string.Format("{0:d}",saleDate));	

    }
    public void ExecHeadInsert()
    {
		if(m_insertHead!=null)
        {
			int ii=0;
			m_insertHead(ii++,100,"商品条形码");
			m_insertHead(ii++,150,"商品名称");
			m_insertHead(ii++,60,"销售额");
			m_insertHead(ii++,60,"利润");
			m_insertHead(ii++,60,"未结数");
			m_insertHead(ii++,60,"未结额");
			m_insertHead(ii++,60,"销售数");
			m_insertHead(ii++,60,"出库数");
			m_insertHead(ii++,60,"入库数");
			m_insertHead(ii++,80,"合计未结数");
			m_insertHead(ii++,80,"合计未结额");
			m_insertHead(ii++,60,"库存数");
			m_insertHead(ii++,80,"合计销售数");
			m_insertHead(ii++,80,"合计出库数");
			m_insertHead(ii++,80,"合计入库数");
			m_insertHead(ii++,90,"合计销售利润");
			m_insertHead(ii++,90,"合计 出库亏损");
			m_insertHead(ii++,90,"合计入库额");
			m_insertHead(ii++,90,"合计销售额");
			m_insertHead(ii++,90,"当前库存额");
			m_insertHead(ii++,90,"合计成本");
			m_insertHead(ii++,90,"当日出库额");
			m_insertHead(ii++,90,"当日损耗额");
			m_insertHead(ii++,100,"当日入库额");
			m_insertHead(ii++,90,"当日销售成本");
			m_insertHead(ii++,90,"合计出库额");
			m_insertHead(ii++,90,"合计出库成本");
			m_insertHead(ii++,80,"销售日期");
		}		
    }
    public void ExecDataInsert()
	{
		if(m_insertRow==null)
			return;
		int ii=0;
     	m_insertRow(0,ii++,commodityID);
     	m_insertRow(0,ii++,commodityName);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",saleMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",profitMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",unsettleAmount)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",unsettleMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",saleAmount)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",returnedAmount)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",stockAmount)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",unsettleAllAmount)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",unsettleAllMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",storageAmount)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",saleAllAmount)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",returnedAllAmount)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",stockAllAmount)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",profitAllMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",lossAllMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",stockAllMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",saleAllMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F4}",storageMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",costAllMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",returnedMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",lossMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",stockMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",costMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",returnedAllMoney)/***/)
);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",returnedCostAllMoney)/***/)
);
     	m_insertRow(0,ii++,			saleDate.ToString().CompareTo("1001-1-1")<0?"":string.Format("{0:d}",saleDate));
    }
    public void ExecDataInsertByQuery(DetachedCriteria dc)
    {
      
         IList list=dao.List(dc); 
        
        if(m_insertHead!=null)
        {
			int ii=0;
			m_insertHead(ii++,100,"商品条形码");
			m_insertHead(ii++,150,"商品名称");
			m_insertHead(ii++,60,"销售额");
			m_insertHead(ii++,60,"利润");
			m_insertHead(ii++,60,"未结数");
			m_insertHead(ii++,60,"未结额");
			m_insertHead(ii++,60,"销售数");
			m_insertHead(ii++,60,"出库数");
			m_insertHead(ii++,60,"入库数");
			m_insertHead(ii++,80,"合计未结数");
			m_insertHead(ii++,80,"合计未结额");
			m_insertHead(ii++,60,"库存数");
			m_insertHead(ii++,80,"合计销售数");
			m_insertHead(ii++,80,"合计出库数");
			m_insertHead(ii++,80,"合计入库数");
			m_insertHead(ii++,90,"合计销售利润");
			m_insertHead(ii++,90,"合计 出库亏损");
			m_insertHead(ii++,90,"合计入库额");
			m_insertHead(ii++,90,"合计销售额");
			m_insertHead(ii++,90,"当前库存额");
			m_insertHead(ii++,90,"合计成本");
			m_insertHead(ii++,90,"当日出库额");
			m_insertHead(ii++,90,"当日损耗额");
			m_insertHead(ii++,100,"当日入库额");
			m_insertHead(ii++,90,"当日销售成本");
			m_insertHead(ii++,90,"合计出库额");
			m_insertHead(ii++,90,"合计出库成本");
			m_insertHead(ii++,80,"销售日期");
		}		
		
      if(m_insertRow!=null)
      {
        int j=0;
        foreach(Salereport obj in list)			
        {
		  int ii=0;
	     
m_insertRow(j,ii++,obj.commodityID.ToString());
m_insertRow(j,ii++,obj.commodityName.ToString());
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.saleMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.profitMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.unsettleAmount)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.unsettleMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.saleAmount)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.returnedAmount)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.stockAmount)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.unsettleAllAmount)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.unsettleAllMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.storageAmount)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.saleAllAmount)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.returnedAllAmount)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.stockAllAmount)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.profitAllMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.lossAllMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.stockAllMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.saleAllMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F4}",obj.storageMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.costAllMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.returnedMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.lossMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.stockMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.costMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.returnedAllMoney)
					)
);
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.returnedCostAllMoney)
					)
);
m_insertRow(j,ii++,			obj.saleDate.ToString().CompareTo("1001-1-1")<0?"":string.Format("{0:d}",obj.saleDate)
);
		j++;
        }
        

	
       }
    }

    
    public IList List(DetachedCriteria dc)
    {
        try
        {
           
            return dao.List(dc);
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }
    
    public bool Init(DetachedCriteria dc)
    {
    
    		Salereport obj=dao.Get(dc);
    		if(obj==null)
    			return false;
    		else
    		{
    			__salereport=obj;
            	return true;
            }
        
    }
    public static t_salereport Get(DetachedCriteria dc)
    {
    	
    	Salereport obj=((SalereportDao)SpringContext.Context.GetObject("SalereportDao"))
	 	.Get(dc);
	 	if(obj==null)
	 		return null;
	 	else
	 		return new t_salereport( obj );
        
    }
	 public static t_salereport GetBySeqID(long val)
	 {
	 	Salereport obj=((SalereportDao)SpringContext.Context.GetObject("SalereportDao"))
	 	.GetBySeqID(val);
	 	if(obj==null)
	 		return null;
	 	else
	 		return new t_salereport( obj );
	 	
	 	
	 }
	 public  bool InitBySeqID(long val)
	 {
	 	

	 	Salereport obj=dao.GetBySeqID(val) ;
	 	if(obj==null)
	 		return false;
	 	else
	 	{
	 		__salereport=obj;
	 		return true;
	 	}
	 	
	 	
	 }
    
       public bool showInForm(Control.ControlCollection Controls)
    {
        try
        {
             
		if(Controls["seqID"]!=null)
		{
			Controls["seqID"].Text=				(				  string.Format("{0}",seqID)				  );
		}
		if(Controls["commoditySeqID"]!=null)
		{
			Controls["commoditySeqID"].Text=				(				  string.Format("{0}",commoditySeqID)				  );
		}
		if(Controls["commodityID"]!=null)
		{
			Controls["commodityID"].Text=commodityID;
		}
		if(Controls["commodityName"]!=null)
		{
			Controls["commodityName"].Text=commodityName;
		}
		if(Controls["saleMoney"]!=null)
		{
			Controls["saleMoney"].Text=/***/(						string.Format("{0:F2}",saleMoney)/***/)
;
		}
		if(Controls["profitMoney"]!=null)
		{
			Controls["profitMoney"].Text=/***/(						string.Format("{0:F2}",profitMoney)/***/)
;
		}
		if(Controls["unsettleAmount"]!=null)
		{
			Controls["unsettleAmount"].Text=/***/(						string.Format("{0:F2}",unsettleAmount)/***/)
;
		}
		if(Controls["unsettleMoney"]!=null)
		{
			Controls["unsettleMoney"].Text=/***/(						string.Format("{0:F2}",unsettleMoney)/***/)
;
		}
		if(Controls["saleAmount"]!=null)
		{
			Controls["saleAmount"].Text=/***/(						string.Format("{0:F2}",saleAmount)/***/)
;
		}
		if(Controls["returnedAmount"]!=null)
		{
			Controls["returnedAmount"].Text=/***/(						string.Format("{0:F2}",returnedAmount)/***/)
;
		}
		if(Controls["stockAmount"]!=null)
		{
			Controls["stockAmount"].Text=/***/(						string.Format("{0:F2}",stockAmount)/***/)
;
		}
		if(Controls["unsettleAllAmount"]!=null)
		{
			Controls["unsettleAllAmount"].Text=/***/(						string.Format("{0:F2}",unsettleAllAmount)/***/)
;
		}
		if(Controls["unsettleAllMoney"]!=null)
		{
			Controls["unsettleAllMoney"].Text=/***/(						string.Format("{0:F2}",unsettleAllMoney)/***/)
;
		}
		if(Controls["storageAmount"]!=null)
		{
			Controls["storageAmount"].Text=/***/(						string.Format("{0:F2}",storageAmount)/***/)
;
		}
		if(Controls["saleAllAmount"]!=null)
		{
			Controls["saleAllAmount"].Text=/***/(						string.Format("{0:F2}",saleAllAmount)/***/)
;
		}
		if(Controls["returnedAllAmount"]!=null)
		{
			Controls["returnedAllAmount"].Text=/***/(						string.Format("{0:F2}",returnedAllAmount)/***/)
;
		}
		if(Controls["stockAllAmount"]!=null)
		{
			Controls["stockAllAmount"].Text=/***/(						string.Format("{0:F2}",stockAllAmount)/***/)
;
		}
		if(Controls["profitAllMoney"]!=null)
		{
			Controls["profitAllMoney"].Text=/***/(						string.Format("{0:F2}",profitAllMoney)/***/)
;
		}
		if(Controls["lossAllMoney"]!=null)
		{
			Controls["lossAllMoney"].Text=/***/(						string.Format("{0:F2}",lossAllMoney)/***/)
;
		}
		if(Controls["stockAllMoney"]!=null)
		{
			Controls["stockAllMoney"].Text=/***/(						string.Format("{0:F2}",stockAllMoney)/***/)
;
		}
		if(Controls["saleAllMoney"]!=null)
		{
			Controls["saleAllMoney"].Text=/***/(						string.Format("{0:F2}",saleAllMoney)/***/)
;
		}
		if(Controls["storageMoney"]!=null)
		{
			Controls["storageMoney"].Text=/***/(						string.Format("{0:F4}",storageMoney)/***/)
;
		}
		if(Controls["costAllMoney"]!=null)
		{
			Controls["costAllMoney"].Text=/***/(						string.Format("{0:F2}",costAllMoney)/***/)
;
		}
		if(Controls["returnedMoney"]!=null)
		{
			Controls["returnedMoney"].Text=/***/(						string.Format("{0:F2}",returnedMoney)/***/)
;
		}
		if(Controls["lossMoney"]!=null)
		{
			Controls["lossMoney"].Text=/***/(						string.Format("{0:F2}",lossMoney)/***/)
;
		}
		if(Controls["stockMoney"]!=null)
		{
			Controls["stockMoney"].Text=/***/(						string.Format("{0:F2}",stockMoney)/***/)
;
		}
		if(Controls["costMoney"]!=null)
		{
			Controls["costMoney"].Text=/***/(						string.Format("{0:F2}",costMoney)/***/)
;
		}
		if(Controls["returnedAllMoney"]!=null)
		{
			Controls["returnedAllMoney"].Text=/***/(						string.Format("{0:F2}",returnedAllMoney)/***/)
;
		}
		if(Controls["returnedCostAllMoney"]!=null)
		{
			Controls["returnedCostAllMoney"].Text=/***/(						string.Format("{0:F2}",returnedCostAllMoney)/***/)
;
		}
		if(Controls["saleDate"]!=null)
		{
			Controls["saleDate"].Text=			saleDate.ToString().CompareTo("1001-1-1")<0?"":string.Format("{0:d}",saleDate);
		}
			return true;
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
            
        }
    }
    public  t_salereport Init(Salereport item)
    {
        __salereport=item;
        return this;
    }

    
     public bool initByForm(Control.ControlCollection Controls)
    {
        try
        {
             
		if(Controls["seqID"]!=null)
		{
			
			if(Controls["seqID"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["seqID"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{seqID=(v==""?consts.long_min:Convert.ToInt32(v));}
				catch
				{
					 Controls["seqID"].Focus();
					throw  (new Exception("编号格式不正确！！"));
				}
				
			}
			else
			{
				try{seqID=(Controls["seqID"].Text==""?consts.long_min:Convert.ToInt32(Controls["seqID"].Text));}
				catch
				{
					 Controls["seqID"].Focus();
					throw  (new Exception("编号格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["commoditySeqID"]!=null)
		{
			
			if(Controls["commoditySeqID"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["commoditySeqID"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{commoditySeqID=(v==""?consts.long_min:Convert.ToInt32(v));}
				catch
				{
					 Controls["commoditySeqID"].Focus();
					throw  (new Exception("商品序号格式不正确！！"));
				}
				
			}
			else
			{
				try{commoditySeqID=(Controls["commoditySeqID"].Text==""?consts.long_min:Convert.ToInt32(Controls["commoditySeqID"].Text));}
				catch
				{
					 Controls["commoditySeqID"].Focus();
					throw  (new Exception("商品序号格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["commodityID"]!=null)
		{
			
			if(Controls["commodityID"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["commodityID"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{commodityID=v;}
				catch
				{
					 Controls["commodityID"].Focus();
					throw  (new Exception("商品条形码格式不正确！！"));
				}
				
			}
			else
			{
				try{commodityID=Controls["commodityID"].Text;}
				catch
				{
					 Controls["commodityID"].Focus();
					throw  (new Exception("商品条形码格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["commodityName"]!=null)
		{
			
			if(Controls["commodityName"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["commodityName"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{commodityName=v;}
				catch
				{
					 Controls["commodityName"].Focus();
					throw  (new Exception("商品名称格式不正确！！"));
				}
				
			}
			else
			{
				try{commodityName=Controls["commodityName"].Text;}
				catch
				{
					 Controls["commodityName"].Focus();
					throw  (new Exception("商品名称格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["saleMoney"]!=null)
		{
			
			if(Controls["saleMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["saleMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{saleMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["saleMoney"].Focus();
					throw  (new Exception("销售额格式不正确！！"));
				}
				
			}
			else
			{
				try{saleMoney=(Controls["saleMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["saleMoney"].Text));}
				catch
				{
					 Controls["saleMoney"].Focus();
					throw  (new Exception("销售额格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["profitMoney"]!=null)
		{
			
			if(Controls["profitMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["profitMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{profitMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["profitMoney"].Focus();
					throw  (new Exception("利润格式不正确！！"));
				}
				
			}
			else
			{
				try{profitMoney=(Controls["profitMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["profitMoney"].Text));}
				catch
				{
					 Controls["profitMoney"].Focus();
					throw  (new Exception("利润格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["unsettleAmount"]!=null)
		{
			
			if(Controls["unsettleAmount"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["unsettleAmount"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{unsettleAmount=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["unsettleAmount"].Focus();
					throw  (new Exception("未结数格式不正确！！"));
				}
				
			}
			else
			{
				try{unsettleAmount=(Controls["unsettleAmount"].Text==""?consts.double_min:Convert.ToDouble(Controls["unsettleAmount"].Text));}
				catch
				{
					 Controls["unsettleAmount"].Focus();
					throw  (new Exception("未结数格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["unsettleMoney"]!=null)
		{
			
			if(Controls["unsettleMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["unsettleMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{unsettleMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["unsettleMoney"].Focus();
					throw  (new Exception("未结额格式不正确！！"));
				}
				
			}
			else
			{
				try{unsettleMoney=(Controls["unsettleMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["unsettleMoney"].Text));}
				catch
				{
					 Controls["unsettleMoney"].Focus();
					throw  (new Exception("未结额格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["saleAmount"]!=null)
		{
			
			if(Controls["saleAmount"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["saleAmount"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{saleAmount=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["saleAmount"].Focus();
					throw  (new Exception("销售数格式不正确！！"));
				}
				
			}
			else
			{
				try{saleAmount=(Controls["saleAmount"].Text==""?consts.double_min:Convert.ToDouble(Controls["saleAmount"].Text));}
				catch
				{
					 Controls["saleAmount"].Focus();
					throw  (new Exception("销售数格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["returnedAmount"]!=null)
		{
			
			if(Controls["returnedAmount"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["returnedAmount"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{returnedAmount=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["returnedAmount"].Focus();
					throw  (new Exception("出库数格式不正确！！"));
				}
				
			}
			else
			{
				try{returnedAmount=(Controls["returnedAmount"].Text==""?consts.double_min:Convert.ToDouble(Controls["returnedAmount"].Text));}
				catch
				{
					 Controls["returnedAmount"].Focus();
					throw  (new Exception("出库数格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["stockAmount"]!=null)
		{
			
			if(Controls["stockAmount"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["stockAmount"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{stockAmount=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["stockAmount"].Focus();
					throw  (new Exception("入库数格式不正确！！"));
				}
				
			}
			else
			{
				try{stockAmount=(Controls["stockAmount"].Text==""?consts.double_min:Convert.ToDouble(Controls["stockAmount"].Text));}
				catch
				{
					 Controls["stockAmount"].Focus();
					throw  (new Exception("入库数格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["unsettleAllAmount"]!=null)
		{
			
			if(Controls["unsettleAllAmount"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["unsettleAllAmount"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{unsettleAllAmount=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["unsettleAllAmount"].Focus();
					throw  (new Exception("合计未结数格式不正确！！"));
				}
				
			}
			else
			{
				try{unsettleAllAmount=(Controls["unsettleAllAmount"].Text==""?consts.double_min:Convert.ToDouble(Controls["unsettleAllAmount"].Text));}
				catch
				{
					 Controls["unsettleAllAmount"].Focus();
					throw  (new Exception("合计未结数格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["unsettleAllMoney"]!=null)
		{
			
			if(Controls["unsettleAllMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["unsettleAllMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{unsettleAllMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["unsettleAllMoney"].Focus();
					throw  (new Exception("合计未结额格式不正确！！"));
				}
				
			}
			else
			{
				try{unsettleAllMoney=(Controls["unsettleAllMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["unsettleAllMoney"].Text));}
				catch
				{
					 Controls["unsettleAllMoney"].Focus();
					throw  (new Exception("合计未结额格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["storageAmount"]!=null)
		{
			
			if(Controls["storageAmount"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["storageAmount"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{storageAmount=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["storageAmount"].Focus();
					throw  (new Exception("库存数格式不正确！！"));
				}
				
			}
			else
			{
				try{storageAmount=(Controls["storageAmount"].Text==""?consts.double_min:Convert.ToDouble(Controls["storageAmount"].Text));}
				catch
				{
					 Controls["storageAmount"].Focus();
					throw  (new Exception("库存数格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["saleAllAmount"]!=null)
		{
			
			if(Controls["saleAllAmount"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["saleAllAmount"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{saleAllAmount=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["saleAllAmount"].Focus();
					throw  (new Exception("合计销售数格式不正确！！"));
				}
				
			}
			else
			{
				try{saleAllAmount=(Controls["saleAllAmount"].Text==""?consts.double_min:Convert.ToDouble(Controls["saleAllAmount"].Text));}
				catch
				{
					 Controls["saleAllAmount"].Focus();
					throw  (new Exception("合计销售数格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["returnedAllAmount"]!=null)
		{
			
			if(Controls["returnedAllAmount"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["returnedAllAmount"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{returnedAllAmount=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["returnedAllAmount"].Focus();
					throw  (new Exception("合计出库数格式不正确！！"));
				}
				
			}
			else
			{
				try{returnedAllAmount=(Controls["returnedAllAmount"].Text==""?consts.double_min:Convert.ToDouble(Controls["returnedAllAmount"].Text));}
				catch
				{
					 Controls["returnedAllAmount"].Focus();
					throw  (new Exception("合计出库数格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["stockAllAmount"]!=null)
		{
			
			if(Controls["stockAllAmount"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["stockAllAmount"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{stockAllAmount=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["stockAllAmount"].Focus();
					throw  (new Exception("合计入库数格式不正确！！"));
				}
				
			}
			else
			{
				try{stockAllAmount=(Controls["stockAllAmount"].Text==""?consts.double_min:Convert.ToDouble(Controls["stockAllAmount"].Text));}
				catch
				{
					 Controls["stockAllAmount"].Focus();
					throw  (new Exception("合计入库数格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["profitAllMoney"]!=null)
		{
			
			if(Controls["profitAllMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["profitAllMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{profitAllMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["profitAllMoney"].Focus();
					throw  (new Exception("合计销售利润格式不正确！！"));
				}
				
			}
			else
			{
				try{profitAllMoney=(Controls["profitAllMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["profitAllMoney"].Text));}
				catch
				{
					 Controls["profitAllMoney"].Focus();
					throw  (new Exception("合计销售利润格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["lossAllMoney"]!=null)
		{
			
			if(Controls["lossAllMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["lossAllMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{lossAllMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["lossAllMoney"].Focus();
					throw  (new Exception("合计 出库亏损格式不正确！！"));
				}
				
			}
			else
			{
				try{lossAllMoney=(Controls["lossAllMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["lossAllMoney"].Text));}
				catch
				{
					 Controls["lossAllMoney"].Focus();
					throw  (new Exception("合计 出库亏损格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["stockAllMoney"]!=null)
		{
			
			if(Controls["stockAllMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["stockAllMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{stockAllMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["stockAllMoney"].Focus();
					throw  (new Exception("合计入库额格式不正确！！"));
				}
				
			}
			else
			{
				try{stockAllMoney=(Controls["stockAllMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["stockAllMoney"].Text));}
				catch
				{
					 Controls["stockAllMoney"].Focus();
					throw  (new Exception("合计入库额格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["saleAllMoney"]!=null)
		{
			
			if(Controls["saleAllMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["saleAllMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{saleAllMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["saleAllMoney"].Focus();
					throw  (new Exception("合计销售额格式不正确！！"));
				}
				
			}
			else
			{
				try{saleAllMoney=(Controls["saleAllMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["saleAllMoney"].Text));}
				catch
				{
					 Controls["saleAllMoney"].Focus();
					throw  (new Exception("合计销售额格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["storageMoney"]!=null)
		{
			
			if(Controls["storageMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["storageMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{storageMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["storageMoney"].Focus();
					throw  (new Exception("当前库存额格式不正确！！"));
				}
				
			}
			else
			{
				try{storageMoney=(Controls["storageMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["storageMoney"].Text));}
				catch
				{
					 Controls["storageMoney"].Focus();
					throw  (new Exception("当前库存额格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["costAllMoney"]!=null)
		{
			
			if(Controls["costAllMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["costAllMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{costAllMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["costAllMoney"].Focus();
					throw  (new Exception("合计成本格式不正确！！"));
				}
				
			}
			else
			{
				try{costAllMoney=(Controls["costAllMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["costAllMoney"].Text));}
				catch
				{
					 Controls["costAllMoney"].Focus();
					throw  (new Exception("合计成本格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["returnedMoney"]!=null)
		{
			
			if(Controls["returnedMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["returnedMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{returnedMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["returnedMoney"].Focus();
					throw  (new Exception("当日出库额格式不正确！！"));
				}
				
			}
			else
			{
				try{returnedMoney=(Controls["returnedMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["returnedMoney"].Text));}
				catch
				{
					 Controls["returnedMoney"].Focus();
					throw  (new Exception("当日出库额格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["lossMoney"]!=null)
		{
			
			if(Controls["lossMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["lossMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{lossMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["lossMoney"].Focus();
					throw  (new Exception("当日损耗额格式不正确！！"));
				}
				
			}
			else
			{
				try{lossMoney=(Controls["lossMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["lossMoney"].Text));}
				catch
				{
					 Controls["lossMoney"].Focus();
					throw  (new Exception("当日损耗额格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["stockMoney"]!=null)
		{
			
			if(Controls["stockMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["stockMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{stockMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["stockMoney"].Focus();
					throw  (new Exception("当日入库额格式不正确！！"));
				}
				
			}
			else
			{
				try{stockMoney=(Controls["stockMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["stockMoney"].Text));}
				catch
				{
					 Controls["stockMoney"].Focus();
					throw  (new Exception("当日入库额格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["costMoney"]!=null)
		{
			
			if(Controls["costMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["costMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{costMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["costMoney"].Focus();
					throw  (new Exception("当日销售成本格式不正确！！"));
				}
				
			}
			else
			{
				try{costMoney=(Controls["costMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["costMoney"].Text));}
				catch
				{
					 Controls["costMoney"].Focus();
					throw  (new Exception("当日销售成本格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["returnedAllMoney"]!=null)
		{
			
			if(Controls["returnedAllMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["returnedAllMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{returnedAllMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["returnedAllMoney"].Focus();
					throw  (new Exception("合计出库额格式不正确！！"));
				}
				
			}
			else
			{
				try{returnedAllMoney=(Controls["returnedAllMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["returnedAllMoney"].Text));}
				catch
				{
					 Controls["returnedAllMoney"].Focus();
					throw  (new Exception("合计出库额格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["returnedCostAllMoney"]!=null)
		{
			
			if(Controls["returnedCostAllMoney"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["returnedCostAllMoney"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{returnedCostAllMoney=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["returnedCostAllMoney"].Focus();
					throw  (new Exception("合计出库成本格式不正确！！"));
				}
				
			}
			else
			{
				try{returnedCostAllMoney=(Controls["returnedCostAllMoney"].Text==""?consts.double_min:Convert.ToDouble(Controls["returnedCostAllMoney"].Text));}
				catch
				{
					 Controls["returnedCostAllMoney"].Focus();
					throw  (new Exception("合计出库成本格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["saleDate"]!=null)
		{
			
			if(Controls["saleDate"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["saleDate"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{saleDate=(v==""?new DateTime(1000,1,1):Convert.ToDateTime(v));}
				catch
				{
					 Controls["saleDate"].Focus();
					throw  (new Exception("销售日期格式不正确！！"));
				}
				
			}
			else
			{
				try{saleDate=(Controls["saleDate"].Text==""?new DateTime(1000,1,1):Convert.ToDateTime(Controls["saleDate"].Text));}
				catch
				{
					 Controls["saleDate"].Focus();
					throw  (new Exception("销售日期格式不正确！！"));
				}
				
			}
				
				
		}
			return true;
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
            
        }
    }
    

}

}
